{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2024-09-19T13:25:57.266002Z",
     "start_time": "2024-09-19T13:25:57.239529Z"
    }
   },
   "source": [
    "import pandas as pd \n",
    "from sklearn.tree import DecisionTreeClassifier\n",
    "from sklearn.preprocessing import StandardScaler \n",
    "from sklearn.model_selection import train_test_split \n",
    "from sklearn.model_selection import GridSearchCV\n",
    "from sklearn.metrics import  roc_auc_score\n",
    "from sklearn.metrics import roc_curve\n",
    "from sklearn.metrics import  auc\n",
    "from sklearn.ensemble import  GradientBoostingClassifier "
   ],
   "outputs": [],
   "execution_count": 15
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-09-19T13:05:57.092579Z",
     "start_time": "2024-09-19T13:05:56.199441Z"
    }
   },
   "cell_type": "code",
   "source": [
    "#获取特征工程处理完的数据\n",
    "train_data = pd.read_csv(r\"D:\\桌面\\天猫复购预测\\data\\data_format1\\\\train_all_k.csv\")\n",
    "test_data = pd.read_csv(r\"D:\\桌面\\天猫复购预测\\data\\data_format1\\\\test_all_k.csv\")\n",
    "all_data = pd.read_csv(r\"D:\\桌面\\天猫复购预测\\data\\data_format1\\all_k.csv\")"
   ],
   "id": "c2bcea018c95b942",
   "outputs": [],
   "execution_count": 2
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-09-19T13:05:57.096589Z",
     "start_time": "2024-09-19T13:05:57.093597Z"
    }
   },
   "cell_type": "code",
   "source": "train_data_1 = train_data ",
   "id": "4324d83b796a0d72",
   "outputs": [],
   "execution_count": 3
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-09-19T13:05:57.182674Z",
     "start_time": "2024-09-19T13:05:57.097100Z"
    }
   },
   "cell_type": "code",
   "source": "train_data_1.fillna(0) #使用 0 填充train_data_1中的缺失值。",
   "id": "ac9bed2959900a2",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "        user_id  merchant_id  label  prob  age_range  gender  sell_sum  \\\n",
       "0         34176         3906    0.0   0.0        6.0     0.0       451   \n",
       "1         34176          121    0.0   0.0        6.0     0.0       451   \n",
       "2         34176         4356    1.0   0.0        6.0     0.0       451   \n",
       "3         34176         2217    0.0   0.0        6.0     0.0       451   \n",
       "4        230784         4818    0.0   0.0        0.0     0.0        54   \n",
       "...         ...          ...    ...   ...        ...     ...       ...   \n",
       "257136   359807         4325    0.0   0.0        4.0     1.0       117   \n",
       "257137   294527         3971    0.0   0.0        0.0     1.0       198   \n",
       "257138   294527          152    0.0   0.0        0.0     1.0       198   \n",
       "257139   294527         2537    0.0   0.0        0.0     1.0       198   \n",
       "257140   229247         4140    0.0   0.0        4.0     2.0       194   \n",
       "\n",
       "        seller_id_unique  cat_id_unique  time_stamp_unique  ...  \\\n",
       "0                    109             45                 47  ...   \n",
       "1                    109             45                 47  ...   \n",
       "2                    109             45                 47  ...   \n",
       "3                    109             45                 47  ...   \n",
       "4                     20             17                 16  ...   \n",
       "...                  ...            ...                ...  ...   \n",
       "257136                33             25                 12  ...   \n",
       "257137                38             20                  6  ...   \n",
       "257138                38             20                  6  ...   \n",
       "257139                38             20                  6  ...   \n",
       "257140                50             29                 23  ...   \n",
       "\n",
       "        brand_id_most  action_type_most  seller_id_most_cnt  cat_id_most_cnt  \\\n",
       "0              4094.0                 0                  70               98   \n",
       "1              4094.0                 0                  70               98   \n",
       "2              4094.0                 0                  70               98   \n",
       "3              4094.0                 0                  70               98   \n",
       "4              1236.0                 0                  10                9   \n",
       "...               ...               ...                 ...              ...   \n",
       "257136         2276.0                 0                  22               15   \n",
       "257137         6143.0                 0                  28               38   \n",
       "257138         6143.0                 0                  28               38   \n",
       "257139         6143.0                 0                  28               38   \n",
       "257140         5697.0                 0                  24               33   \n",
       "\n",
       "        brand_id_most_cnt  action_type_most_cnt  action_type_sum_0  \\\n",
       "0                      70                   410                  0   \n",
       "1                      70                   410                  0   \n",
       "2                      70                   410                  0   \n",
       "3                      70                   410                  0   \n",
       "4                      10                    47                  0   \n",
       "...                   ...                   ...                ...   \n",
       "257136                 25                   107                  0   \n",
       "257137                 28                   162                  0   \n",
       "257138                 28                   162                  0   \n",
       "257139                 28                   162                  0   \n",
       "257140                 24                   181                  0   \n",
       "\n",
       "        action_type_sum_1  action_type_sum_2  action_type_sum_3  \n",
       "0                       0                  0                  0  \n",
       "1                       0                  0                  0  \n",
       "2                       0                  0                  0  \n",
       "3                       0                  0                  0  \n",
       "4                       0                  0                  0  \n",
       "...                   ...                ...                ...  \n",
       "257136                  0                  0                  0  \n",
       "257137                  0                  0                  0  \n",
       "257138                  0                  0                  0  \n",
       "257139                  0                  0                  0  \n",
       "257140                  0                  0                  0  \n",
       "\n",
       "[257141 rows x 24 columns]"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>user_id</th>\n",
       "      <th>merchant_id</th>\n",
       "      <th>label</th>\n",
       "      <th>prob</th>\n",
       "      <th>age_range</th>\n",
       "      <th>gender</th>\n",
       "      <th>sell_sum</th>\n",
       "      <th>seller_id_unique</th>\n",
       "      <th>cat_id_unique</th>\n",
       "      <th>time_stamp_unique</th>\n",
       "      <th>...</th>\n",
       "      <th>brand_id_most</th>\n",
       "      <th>action_type_most</th>\n",
       "      <th>seller_id_most_cnt</th>\n",
       "      <th>cat_id_most_cnt</th>\n",
       "      <th>brand_id_most_cnt</th>\n",
       "      <th>action_type_most_cnt</th>\n",
       "      <th>action_type_sum_0</th>\n",
       "      <th>action_type_sum_1</th>\n",
       "      <th>action_type_sum_2</th>\n",
       "      <th>action_type_sum_3</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>34176</td>\n",
       "      <td>3906</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>451</td>\n",
       "      <td>109</td>\n",
       "      <td>45</td>\n",
       "      <td>47</td>\n",
       "      <td>...</td>\n",
       "      <td>4094.0</td>\n",
       "      <td>0</td>\n",
       "      <td>70</td>\n",
       "      <td>98</td>\n",
       "      <td>70</td>\n",
       "      <td>410</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>34176</td>\n",
       "      <td>121</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>451</td>\n",
       "      <td>109</td>\n",
       "      <td>45</td>\n",
       "      <td>47</td>\n",
       "      <td>...</td>\n",
       "      <td>4094.0</td>\n",
       "      <td>0</td>\n",
       "      <td>70</td>\n",
       "      <td>98</td>\n",
       "      <td>70</td>\n",
       "      <td>410</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>34176</td>\n",
       "      <td>4356</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>451</td>\n",
       "      <td>109</td>\n",
       "      <td>45</td>\n",
       "      <td>47</td>\n",
       "      <td>...</td>\n",
       "      <td>4094.0</td>\n",
       "      <td>0</td>\n",
       "      <td>70</td>\n",
       "      <td>98</td>\n",
       "      <td>70</td>\n",
       "      <td>410</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>34176</td>\n",
       "      <td>2217</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>451</td>\n",
       "      <td>109</td>\n",
       "      <td>45</td>\n",
       "      <td>47</td>\n",
       "      <td>...</td>\n",
       "      <td>4094.0</td>\n",
       "      <td>0</td>\n",
       "      <td>70</td>\n",
       "      <td>98</td>\n",
       "      <td>70</td>\n",
       "      <td>410</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>230784</td>\n",
       "      <td>4818</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>54</td>\n",
       "      <td>20</td>\n",
       "      <td>17</td>\n",
       "      <td>16</td>\n",
       "      <td>...</td>\n",
       "      <td>1236.0</td>\n",
       "      <td>0</td>\n",
       "      <td>10</td>\n",
       "      <td>9</td>\n",
       "      <td>10</td>\n",
       "      <td>47</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>257136</th>\n",
       "      <td>359807</td>\n",
       "      <td>4325</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>117</td>\n",
       "      <td>33</td>\n",
       "      <td>25</td>\n",
       "      <td>12</td>\n",
       "      <td>...</td>\n",
       "      <td>2276.0</td>\n",
       "      <td>0</td>\n",
       "      <td>22</td>\n",
       "      <td>15</td>\n",
       "      <td>25</td>\n",
       "      <td>107</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>257137</th>\n",
       "      <td>294527</td>\n",
       "      <td>3971</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>198</td>\n",
       "      <td>38</td>\n",
       "      <td>20</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>6143.0</td>\n",
       "      <td>0</td>\n",
       "      <td>28</td>\n",
       "      <td>38</td>\n",
       "      <td>28</td>\n",
       "      <td>162</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>257138</th>\n",
       "      <td>294527</td>\n",
       "      <td>152</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>198</td>\n",
       "      <td>38</td>\n",
       "      <td>20</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>6143.0</td>\n",
       "      <td>0</td>\n",
       "      <td>28</td>\n",
       "      <td>38</td>\n",
       "      <td>28</td>\n",
       "      <td>162</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>257139</th>\n",
       "      <td>294527</td>\n",
       "      <td>2537</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>198</td>\n",
       "      <td>38</td>\n",
       "      <td>20</td>\n",
       "      <td>6</td>\n",
       "      <td>...</td>\n",
       "      <td>6143.0</td>\n",
       "      <td>0</td>\n",
       "      <td>28</td>\n",
       "      <td>38</td>\n",
       "      <td>28</td>\n",
       "      <td>162</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>257140</th>\n",
       "      <td>229247</td>\n",
       "      <td>4140</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>194</td>\n",
       "      <td>50</td>\n",
       "      <td>29</td>\n",
       "      <td>23</td>\n",
       "      <td>...</td>\n",
       "      <td>5697.0</td>\n",
       "      <td>0</td>\n",
       "      <td>24</td>\n",
       "      <td>33</td>\n",
       "      <td>24</td>\n",
       "      <td>181</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>257141 rows × 24 columns</p>\n",
       "</div>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 4
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-09-19T13:05:57.187186Z",
     "start_time": "2024-09-19T13:05:57.183678Z"
    }
   },
   "cell_type": "code",
   "source": [
    "label = train_data_1['label']#从train_data_1中提取标签列。\n",
    "del train_data_1['user_id']\n",
    "del train_data_1['merchant_id']\n",
    "del train_data_1['label']"
   ],
   "id": "f771dc96c699a544",
   "outputs": [],
   "execution_count": 5
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-09-19T13:05:57.294221Z",
     "start_time": "2024-09-19T13:05:57.187186Z"
    }
   },
   "cell_type": "code",
   "source": [
    "stdScaler = StandardScaler()#创建一个StandardScaler对象，用于标准化数据。\n",
    "X = stdScaler.fit_transform(train_data_1)#使用StandardScaler对象对train_data_1进行标准化处理。 "
   ],
   "id": "660554683ffc5e84",
   "outputs": [],
   "execution_count": 6
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-09-19T13:20:36.756081Z",
     "start_time": "2024-09-19T13:19:21.028121Z"
    }
   },
   "cell_type": "code",
   "source": [
    "x_train, x_test, y_train, y_test = train_test_split(X, label, test_size=0.2, random_state=9)\n",
    "#决策树 \n",
    "from sklearn.tree import DecisionTreeClassifier\n",
    "dt = DecisionTreeClassifier(max_depth=5 ,random_state=42)\n",
    "dt.fit(x_train,y_train)\n",
    "#网格搜索\n",
    "dt_params = {\n",
    "   'criterion' : [\"gini\",\"entropy\"],\n",
    "   'splitter' : [\"best\",\"random\"],\n",
    "    'max_depth' : [8,10,12]\n",
    "}\n",
    "dt_model = GridSearchCV(dt,param_grid= dt_params,cv=10)\n",
    "dt_model.fit(x_train,y_train)\n",
    "#获取最优参数 \n",
    "dt_best_model = dt_model.best_estimator_\n",
    "dt_proba = dt_best_model.predict_proba(x_test)\n",
    "rf_fpr,rf_tpr,_ =  roc_curve(y_test,dt_proba[:,1])  \n",
    "dt_auc = auc(rf_fpr,rf_tpr) \n",
    "dt_auc"
   ],
   "id": "1fc66e7f51c5981e",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.5547762689387898"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 13
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-09-19T13:26:03.122096Z",
     "start_time": "2024-09-19T13:26:03.118613Z"
    }
   },
   "cell_type": "code",
   "source": [
    "def model_clf(model):\n",
    "    model.fit(X_train, y_train)  # 训练模型\n",
    "    y_train_pred = model.predict_proba(X_train)  # 预测训练集的概率\n",
    "    y_train_pred_pos = y_train_pred[:, 1]  # 获取正类的概率\n",
    "\n",
    "    y_test_pred = model.predict_proba(X_test)  # 预测测试集的概率\n",
    "    y_test_pred_pos = y_test_pred[:, 1]  # 获取正类的概率\n",
    "\n",
    "    auc_train = roc_auc_score(y_train, y_train_pred_pos)  # 计算训练集的 AUC 分数\n",
    "    auc_test = roc_auc_score(y_test, y_test_pred_pos)  # 计算测试集的 AUC 分数\n",
    "\n",
    "    print(f\"Train AUC Score {auc_train}\")  # 打印训练集的 AUC 分数\n",
    "    print(f\"Test AUC Score {auc_test}\")  # 打印测试集的 AUC 分数\n",
    "\n",
    "    fpr, tpr, _ = roc_curve(y_test, y_test_pred_pos)  # 绘制 ROC 曲线\n",
    "    return fpr, tpr  # 返回 FPR 和 TPR"
   ],
   "id": "7edd16c1d41a8aad",
   "outputs": [],
   "execution_count": 17
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-09-19T13:26:05.693810Z",
     "start_time": "2024-09-19T13:26:04.320090Z"
    }
   },
   "cell_type": "code",
   "source": [
    "X_train,X_test, y_train, y_test = train_test_split(train_data_1, label, random_state=0)\n",
    "clf = GradientBoostingClassifier(n_estimators=10,learning_rate=1.0,max_depth=1,random_state=0) \n",
    "model_clf(clf)"
   ],
   "id": "3d9d56390f9dcffc",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Train AUC Score 0.5815606038675936\n",
      "Test AUC Score 0.5695611304135055\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "(array([0.00000000e+00, 9.93065095e-05, 1.32408679e-04, 2.48266274e-04,\n",
       "        3.14470614e-04, 3.31021698e-04, 3.47572783e-04, 3.80674953e-04,\n",
       "        9.76514010e-04, 1.27443354e-03, 1.35718896e-03, 1.40684222e-03,\n",
       "        1.42339330e-03, 1.48959764e-03, 1.52269981e-03, 1.55580198e-03,\n",
       "        4.25362883e-03, 4.60120161e-03, 1.16188616e-02, 1.21319452e-02,\n",
       "        1.34394810e-02, 1.37539516e-02, 1.38367070e-02, 1.40849733e-02,\n",
       "        1.41511776e-02, 1.42008309e-02, 1.71965772e-02, 2.87326834e-02,\n",
       "        3.13477548e-02, 3.16125722e-02, 3.19270428e-02, 3.21918602e-02,\n",
       "        3.82661083e-02, 4.08149754e-02, 4.22052666e-02, 4.27514524e-02,\n",
       "        4.30162697e-02, 4.42244989e-02, 4.42410500e-02, 4.74188583e-02,\n",
       "        4.78491865e-02, 4.94380907e-02, 5.31620848e-02, 6.49630083e-02,\n",
       "        6.50457637e-02, 6.54429898e-02, 6.57905626e-02, 6.87035535e-02,\n",
       "        1.05513166e-01, 1.08062033e-01, 1.08161340e-01, 1.08210993e-01,\n",
       "        1.08939241e-01, 1.11322597e-01, 1.11885334e-01, 1.12795644e-01,\n",
       "        1.17380294e-01, 1.19879508e-01, 1.20045019e-01, 1.22759397e-01,\n",
       "        1.25854450e-01, 1.28833645e-01, 1.65246032e-01, 1.66156342e-01,\n",
       "        1.66354955e-01, 1.67199060e-01, 1.67298366e-01, 1.77692448e-01,\n",
       "        1.78453798e-01, 1.79959946e-01, 1.80986114e-01, 1.84395637e-01,\n",
       "        1.88698919e-01, 1.88748572e-01, 1.90337477e-01, 1.91181582e-01,\n",
       "        2.01294295e-01, 2.02138400e-01, 2.02154951e-01, 2.27511213e-01,\n",
       "        2.82742184e-01, 2.92391466e-01, 2.92871448e-01, 2.93070061e-01,\n",
       "        2.94791374e-01, 2.94940333e-01, 2.95039640e-01, 2.98051937e-01,\n",
       "        2.99756699e-01, 3.14934044e-01, 3.15099555e-01, 3.35738758e-01,\n",
       "        3.68559559e-01, 3.82545226e-01, 4.14290207e-01, 4.75595425e-01,\n",
       "        4.76720899e-01, 4.92014102e-01, 4.92328572e-01, 5.03301941e-01,\n",
       "        5.03599861e-01, 5.14258760e-01, 5.22054321e-01, 5.22501200e-01,\n",
       "        5.26407256e-01, 5.26622420e-01, 5.67222231e-01, 5.72866151e-01,\n",
       "        5.73097867e-01, 6.26392360e-01, 6.49232857e-01, 6.50325229e-01,\n",
       "        6.52145848e-01, 6.53271322e-01, 6.71063738e-01, 6.83112928e-01,\n",
       "        7.01120508e-01, 7.35000579e-01, 7.56864562e-01, 7.59727900e-01,\n",
       "        7.76345189e-01, 7.86739271e-01, 7.86755822e-01, 7.86871679e-01,\n",
       "        7.97894702e-01, 7.98291928e-01, 7.98920869e-01, 8.00542876e-01,\n",
       "        8.03439315e-01, 8.04399278e-01, 8.30169318e-01, 8.30798259e-01,\n",
       "        9.07843559e-01, 9.09597974e-01, 9.50561909e-01, 9.56536851e-01,\n",
       "        9.56569953e-01, 9.56685811e-01, 9.65673050e-01, 9.67857793e-01,\n",
       "        9.70290803e-01, 9.70638375e-01, 9.71482481e-01, 9.75107168e-01,\n",
       "        9.75156822e-01, 9.75223026e-01, 9.75554048e-01, 9.98543505e-01,\n",
       "        9.98560056e-01, 9.98957282e-01, 9.99040037e-01, 9.99966898e-01,\n",
       "        1.00000000e+00]),\n",
       " array([0.00000000e+00, 2.58598397e-04, 2.58598397e-04, 5.17196793e-04,\n",
       "        5.17196793e-04, 5.17196793e-04, 7.75795190e-04, 7.75795190e-04,\n",
       "        2.84458236e-03, 3.36177916e-03, 3.62037755e-03, 4.39617274e-03,\n",
       "        5.17196793e-03, 5.17196793e-03, 5.17196793e-03, 5.17196793e-03,\n",
       "        1.06025343e-02, 1.13783295e-02, 2.27566589e-02, 2.40496509e-02,\n",
       "        2.58598397e-02, 2.68942333e-02, 2.68942333e-02, 2.76700284e-02,\n",
       "        2.79286268e-02, 2.79286268e-02, 3.23247996e-02, 4.80993018e-02,\n",
       "        5.43056633e-02, 5.45642617e-02, 5.50814585e-02, 5.55986553e-02,\n",
       "        6.67183863e-02, 7.16317559e-02, 7.37005431e-02, 7.47349366e-02,\n",
       "        7.55107318e-02, 7.68037238e-02, 7.68037238e-02, 8.14584950e-02,\n",
       "        8.22342901e-02, 8.30100853e-02, 8.92164469e-02, 1.05766744e-01,\n",
       "        1.06025343e-01, 1.06283941e-01, 1.06542539e-01, 1.11714507e-01,\n",
       "        1.60072408e-01, 1.65502974e-01, 1.65502974e-01, 1.65502974e-01,\n",
       "        1.67054564e-01, 1.69899147e-01, 1.70674942e-01, 1.72226532e-01,\n",
       "        1.77657099e-01, 1.81018878e-01, 1.81277476e-01, 1.84122058e-01,\n",
       "        1.86190846e-01, 1.90069822e-01, 2.34548746e-01, 2.35583139e-01,\n",
       "        2.36100336e-01, 2.37651927e-01, 2.37910525e-01, 2.51099043e-01,\n",
       "        2.52133437e-01, 2.54460822e-01, 2.54978019e-01, 2.57564003e-01,\n",
       "        2.61442979e-01, 2.61442979e-01, 2.63253168e-01, 2.64287561e-01,\n",
       "        2.78510473e-01, 2.81613654e-01, 2.81613654e-01, 3.06697698e-01,\n",
       "        3.69795707e-01, 3.79622446e-01, 3.80398242e-01, 3.80656840e-01,\n",
       "        3.81432635e-01, 3.81432635e-01, 3.81432635e-01, 3.86346005e-01,\n",
       "        3.86863201e-01, 4.04965089e-01, 4.04965089e-01, 4.29790535e-01,\n",
       "        4.63149728e-01, 4.75303853e-01, 5.09697440e-01, 5.74864236e-01,\n",
       "        5.75640031e-01, 5.91673132e-01, 5.91931730e-01, 6.00982674e-01,\n",
       "        6.01499871e-01, 6.14688389e-01, 6.23739333e-01, 6.24256530e-01,\n",
       "        6.26842514e-01, 6.27101112e-01, 6.66666667e-01, 6.71838635e-01,\n",
       "        6.71838635e-01, 7.19679338e-01, 7.39332816e-01, 7.39850013e-01,\n",
       "        7.41143005e-01, 7.42177399e-01, 7.63899664e-01, 7.73726403e-01,\n",
       "        7.85621929e-01, 8.12516162e-01, 8.28549263e-01, 8.32428239e-01,\n",
       "        8.45358159e-01, 8.53116111e-01, 8.53116111e-01, 8.53116111e-01,\n",
       "        8.60874063e-01, 8.60874063e-01, 8.61649858e-01, 8.63201448e-01,\n",
       "        8.64753039e-01, 8.65011637e-01, 8.81044738e-01, 8.81303336e-01,\n",
       "        9.32764417e-01, 9.34833204e-01, 9.67158004e-01, 9.71036980e-01,\n",
       "        9.71036980e-01, 9.71036980e-01, 9.78794931e-01, 9.80346522e-01,\n",
       "        9.80863719e-01, 9.81380915e-01, 9.82156711e-01, 9.84742695e-01,\n",
       "        9.84742695e-01, 9.84742695e-01, 9.84742695e-01, 9.99482803e-01,\n",
       "        9.99482803e-01, 9.99741402e-01, 9.99741402e-01, 1.00000000e+00,\n",
       "        1.00000000e+00]))"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 18
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
